package com.zjs.config;




import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
//扫包，将此包下的接口生成代理实现类，并且注册到spring容器中
@MapperScan("com.zjs.mapper")
public class MybatisPlusConfig {
    /**
     * 分页插件 有代码生成器
     * @return
     */
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        return paginationInterceptor;
    }

    /**
     * 无代码生成器，，有代码生器的依赖，会过时
     * @return
     */
    //@Bean
    //public MybatisPlusInterceptor mybatisPlusInterceptor(){
    //    MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
    //    interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
    //    return interceptor;
    //}
}

